<script>
	export default {
		globalData: {
			good: [],
			state: [],
			department: [],
			recheckCycle: [],
			lifeSpan: [],
			rate: [{
				value: 'G',
				text: '高频'
			}, {
				value: 'D',
				text: '低频'
			}],
			cableName: [],
			use: [{
				value: 'N',
				text: '灌内'
			}, {
				value: 'W',
				text: '灌外'
			}],
			good: [],
			checkRequire: [],
		},
		onLaunch: function() {
			console.log('App Launch')
			// 查询图号
			this.GetDateListByName('good')
			// 工装电缆状态
			this.GetDateListByName('state')
			// 部门
			this.GetDateListByName('department')
			// 复验周期
			this.GetDateListByName('recheckCycle')
			// 寿命期限
			this.GetDateListByName('lifeSpan')
			// 电缆名称
			this.GetDateListByName('cableName')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			// 获取数据字典
			GetDateListByName(name) {
				this.$http(`/api/common/GetDateListByName`, {
					name
				}, 'GET').then(r => {
					if (name == 'department') {
						getApp().globalData[name] = r.data
					} else {
						getApp().globalData[name] = r.data.map(d => {
							return {
								value: JSON.stringify(d.id),
								text: d.name
							}
						})
					}

				})
			},
		}
	}
</script>

<style lang="scss">
	// uview-ui库
	@import "@/uni_modules/uview-plus/index.scss";
	/*每个页面公共css */
	@import '@/static/css/reset.scss';
</style>